package my.study.c.consul.consumer.app.util;

import org.apache.hc.client5.http.impl.classic.CloseableHttpClient;
import org.apache.hc.client5.http.impl.classic.HttpClients;

public class MyHttpClientUtil {

    private static CloseableHttpClient httpClient;
//    private static CloseableHttpClient poolHttpClient;

    private MyHttpClientUtil() {
    }

    public static CloseableHttpClient getInstance() {
        if (httpClient == null) {
            httpClient = HttpClients.createDefault();
        }
        return httpClient;
    }

//    public static CloseableHttpClient getPoolInstance() {
//        if (poolHttpClient == null) {
//            PoolingHttpClientConnectionManager cm = new PoolingHttpClientConnectionManager();
//            cm.setMaxTotal(25); //线程数
//            poolHttpClient = HttpClients.createMinimal(cm);
//        }
//        return poolHttpClient;
//    }
}
